草庐IT

python - 在 PyInstaller 中找不到导入的模块

全部标签

go - 构建时在 golang 中找不到包 "github.com/user../../"

我正在尝试从github源代码构建一个项目。我发现一些源代码导入了如下所示的包:import("os""github.com/bivas/rivi/commands""github.com/mitchellh/cli")但是在构建项目时每次都会报错:user-MacBook-Pro:riviuser$gobuildrivi.gorivi.go:6:2:cannotfindpackage"github.com/bivas/rivi/commands"inanyof:/usr/local/Cellar/go/1.7.5/libexec/src/github.com/bivas/rivi/c

go - travis 找不到我的包 golang

我的结构项目currency-quote-api-||-scraping/file.go|-api/file.go|-tests/test.go|-main.go当我在travisCI中运行测试时,出现以下错误tests/scraping_test.go:4:2:cannotfindpackage"currency-quote-api/scraping"inanyof:/home/travis/.gimme/versions/go1.10.2.linux.amd64/src/currency-quote-api/scraping(from$GOROOT)/home/travis/gop

go - 在导入包时出现此错误知道如何解决这个问题吗?

当我运行以下命令时:gogetgithub.com/docker/go-plugins-helpers/volume它打印:github.com/docker/go-connections/sockets../github.com/docker/go-connections/sockets/sockets.go:35:26:dialer.DialContextundefined(typeproxy.DialerhasnofieldormethodDialContext)../github.com/docker/go-connections/sockets/sockets_unix.go

go - Gopath已在个人资料中设置,但仍看不到Go版本

我已经在我的ubuntu系统上安装了go,在我检查go版本时,我的系统仍然无法识别go。 最佳答案 输入bellow命令,它将刷新配置文件中的路径集。source~/.profile 关于go-Gopath已在个人资料中设置,但仍看不到Go版本,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/56830415/

python - 根据相似度最高的值对字典列表进行排序

给定以下python字典列表:results=[[{'id':'001','result':[0,0,0,0,1]},{'id':'002','result':[1,1,1,1,1]},{'id':'003','result':[0,1,1,None,None]},{'id':'004','result':[0,None,None,1,0]},{'id':'005','result':[1,0,None,1,1]},{'id':'006','result':[0,0,0,1,1]}],[{'id':'001','result':[1,0,1,0,1]},{'id':'002','res

go - 看不到 struct Golang 的公共(public)函数

我没有看到我定义的结构的公共(public)方法。有人可以让我明白为什么吗?这是代码://DataSaver.go:packageDataStorageimport("fmt""os")typeDataSaverstruct{//doesn'trelevanttomyquestionfileNamestringfile*os.File}funcPrintStr(){fmt.Println("hello")}然后,我在其他类中有一个主要方法。我初始化了结构,我想调用PrintStr()函数。但是,我无法调用此方法。为什么?谢谢! 最佳答案

go - 多语句优于分解导入语句的情况?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭3年前。Improvethisquestion"ATourofGo"指南说:Thiscodegroupstheimportsintoaparenthesized,"factored"importstatement.import("fmt""math")Youcanalsowritemultipleimportstatements,like:import"fmt"import"math"Butitisgoodstyletousethef

go - 使用 Go 模块时如何获得依赖项的主分支

我正在为一个项目使用Go-modules。当我检索包的依赖项时,它会检索旧版本。如何获取master分支中的代码? 最佳答案 使用:gogetfoo@mastergogetfoo@v1.2.3//forv1.2.3taggogetfoo@master//formastergogetfoo@e3702bed2//foraspecificcommit这里有一些关于版本控制的更多细节:https://github.com/golang/go/wiki/Modules#daily-workflow

go - 导入更新在主包中无法识别

我正在处理一个项目,并且有几个我创建的包,我正在将它们导入到我的主项目中。现在,当我获取代码并将其移动到外部包中时,我可以从我的主项目中调用它的函数。但是一旦我将新函数添加到我的外部包中,我总是会在构建过程中遇到undefinedfunc...错误。我试过重建我的外部包..但没有成功。我能够更新对自定义包的引用的唯一方法是重命名外部包和文件夹。例如,如果我在/project/blah/blah.go中有以下内容:packageblahfuncDoSomethingCool(sstring){fmt.Print(s)}我可以在我的主应用程序(project/web/main.go)中将此

Golang Channel 收不到消息

我尝试探索gochannel,我创建的channelbuffermax10,gomaxprocess是2,但我想知道为什么这段代码收不到消息runtime.GOMAXPROCS(2)messages:=make(chanint,9)gofunc(){for{i:= 最佳答案 您的案例类似于this,虽然它可能在某些时候看起来有效,但不能保证总是有效。只是添加一些上下文,在无缓冲channel中,发送go例程在尝试发送值时被阻塞,并且保证在发送go例程被唤醒(在本例中为main)之前发生接收,所以在这种情况下,这似乎是一个可行的选择。